var ranidae= {};
ranidae.api = {};

ranidae.api.category = {};
ranidae.api.category.create = function( serviceId, categoryName, handler ){
	handler(0);
}
ranidae.api.category.rename = function ( serviceId, categoryId, newName, handler ){
	handler((categoryId % 2) * -1);
}
ranidae.api.category.list = function( serviceId, handler){
	var list = [{id:1,name:'Category 01',son_count:5},{id:2,name:'Category 02',son_count:10},
				{id:3,name:'Category 03',son_count:15},{id:4,name:'Category 04',son_count:20},
				{id:5,name:'Category 05',son_count:25},{id:6,name:'Category 06',son_count:30}];
	handler(list);
}

ranidae.api.article = {};
ranidae.api.article.download = {};
ranidae.api.article.download.byCategory = function( categoryId, handler ){
	var result = {error : 0,url: 'http://www.google.com/test.php'};
	
	handler(result);
}
ranidae.api.article.download.byId = function( articleId, handler ){
	var result = {error : 0,url: 'http://www.google.com/test.php'};
	
	handler(result);
}
ranidae.api.article.list = function( categoryId, handler ){
	var list = [{id:1, title:'Ar01', category:1, state:1, wrote_at:'2006-01-01 14:21'},
				{id:2, title:'Ar02', category:1, state:0, wrote_at:'2006-01-01 14:21'},
				{id:3, title:'Ar03', category:1, state:1, wrote_at:'2006-01-01 14:21'},
				{id:4, title:'Ar04', category:1, state:0, wrote_at:'2006-01-01 14:21'},
				
				{id:5, title:'Ar05', category:2, state:1, wrote_at:'2006-01-01 14:21'},
				{id:6, title:'Ar06', category:2, state:0, wrote_at:'2006-01-01 14:21'},
				{id:7, title:'Ar07', category:2, state:1, wrote_at:'2006-01-01 14:21'},
				
				{id:8, title:'Ar08', category:3, state:1, wrote_at:'2006-01-01 14:21'},
				{id:9, title:'Ar09', category:3, state:0, wrote_at:'2006-01-01 14:21'}
			];
			
	var result = [];
	for ( var i=0; i<list.length; i++ )
		if ( list[i].category == categoryId*1 )
			result.push(list[i]);

	handler(result);
}
ranidae.api.article.lock = function ( article, handler ){
	handler(0);
}
ranidae.api.article.content = function ( article, handler ){
	handler('XXXXXXXXXXXXXXXXXXXXXXXXXX');
}
ranidae.api.article.update = function ( article, title, category, content, handler ){
	handler(0);
}
ranidae.api.article.create = function (title, category, content, handler){
	handler(0);
}
ranidae.api.article.move = function ( articleId, categoryId, handler ){
	handler(0);
}